class Solution
{
public:
    long long waysToBuyPensPencils(int total, int cost1, int cost2)
    {
        long long result = 0;
        for (int penCost = 0; penCost <= total; penCost += cost1)
        {
            int pencilCost = total - penCost;
            result += pencilCost / cost2 + 1;
        }
        return result;
    }
};